//
//  NetProjectTests.swift
//  NetProjectTests
//
//  Created by EDY on 2021/11/1.
//

import XCTest
@testable import NetProject

class NetProjectTests: XCTestCase {

    override func setUpWithError() throws {
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }

    override func tearDownWithError() throws {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
    }

    func testExample() throws {
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
        let arr = [20,30,8,200]
        let v1 = hasCloseureMatch(arr: arr, value: 90, cb: {
            return $0 > $1
        })
        print("===== v1 is \(v1)")
    }
    
    func hasCloseureMatch(arr: [Int],value : Int, cb:(_ num:Int , _ value:Int)->Bool) -> Bool{
        for item in arr{
            if (cb(item,value)){
                return true
            }
        }
        return false
    }

    func testPerformanceExample() throws {
        // This is an example of a performance test case.
        self.measure {
            // Put the code you want to measure the time of here.
        }
    }

}
